package com.tourism.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tourism.admin.common.Result;
import com.tourism.admin.model.entity.Role;
import com.tourism.admin.model.entity.UserRole;
import com.tourism.admin.mapper.RoleMapper;
import com.tourism.admin.service.RoleService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Override
    public List<UserRole> getUserRoleByUserId(Integer userId) {
        return this.baseMapper.getUserRoleByUserId(userId);
    }

    @Override
    public Result<?> deleteRoleByUserId(Integer userId) {
        return Result.success().setData(this.baseMapper.deleteRoleByUserId(userId));
    }

    @Override
    public Result<?> insertUserRole(Integer userId, Integer roleId) {
        return Result.success().setData(this.baseMapper.insertUserRole(userId,roleId));
    }
}
